<template>
	<view class="content">
		<view class="publishItem" v-for="(item,index) in dataArr" :key="index">
			<block v-if="type == 1">
				<view class="flex-row-start item0">
					<view class="title1">信息名称：</view>
					<view class="desc1">{{item.name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">地区：</view>
					<view class="desc1">{{item.area}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">教练姓名：</view>
					<view class="desc1">{{item.teacher_name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">联系方式：</view>
					<view class="desc1">{{item.teacher_phone}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">发布时间：</view>
					<view class="desc1">{{parseTime(item.create_time)}}</view>
				</view>
			</block>
			<block v-if="type == 2">
				<view class="flex-row-start item0">
					<view class="title1">信息名称：</view>
					<view class="desc1">{{item.name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">地区：</view>
					<view class="desc1">{{item.area}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">教练姓名：</view>
					<view class="desc1">{{item.teacher_name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">联系方式：</view>
					<view class="desc1">{{item.teacher_phone}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">发布时间：</view>
					<view class="desc1">{{parseTime(item.create_time)}}</view>
				</view>
			</block>
			<block v-if="type == 3">
				<view class="flex-row-start item0">
					<view class="title1">信息名称：</view>
					<view class="desc1">{{item.name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">地区：</view>
					<view class="desc1">{{item.area}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">教练姓名：</view>
					<view class="desc1">{{item.teacher_name}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">联系方式：</view>
					<view class="desc1">{{item.teacher_phone}}</view>
				</view>
				<view class="flex-row-start item0">
					<view class="title1">发布时间：</view>
					<view class="desc1">{{parseTime(item.create_time)}}</view>
				</view>
			</block>
			<view class="status" style="background-color: green;"  v-if="status == '已支付'">{{item.status}}</view>
			<view class="status" v-else>{{item.status}}</view>
		</view>
		
	</view>
</template>

<script>
	import {publishList} from '@/api/api.js'
	export default {
		data() {
			return {
				page:1,
				dataArr:[],
				type:undefined,//1-个人 2-机构 3-球馆
				
			}
		},
		onLoad(e){
			this.type = e.type
			var title = '个人发布管理'
			if(this.type == 2){
				title = '机构发布管理'
			}
			if(this.type == 3){
				title = '球馆发布管理'
			}
			uni.setNavigationBarTitle({
				title:title
			})
			this.requestList()
			
		},
		methods: {
			requestList(){
				var param = {
					type:this.type,
					page:this.page,
					pageSize:10,
					utoken:uni.getStorageSync('publish-mix-token')
					
				}
				publishList(param).then(res=>{
					if (res.data.code == 200){
						this.dataArr = res.data.data.list
					
					}
					
				})
				
			}
			
		}
	}
</script>

<style lang="scss">
	.publishItem{
		margin-left: 2%;
		width: 96%;
		padding: 20rpx 20rpx 10rpx 20rpx;
		box-sizing: border-box;
		border: 1px solid rgba(238, 238, 238, 1);
		border-radius: 10rpx;
		margin: 20rpx auto;
		position: relative;
		.item0{
			align-items: flex-start;
			margin-bottom: 10rpx;
		}
		.title1{
			font-size: 28rpx;
			line-height: 30rpx;
		}
		.desc1{
			font-size: 26rpx;
			color: rgb(150, 150, 150);
			line-height: 30rpx;
		}
		.status{
			position: absolute;
			right: 0rpx;
			top: 0rpx;
			padding: 6rpx 18rpx;
			color: white;
			font-size: 24rpx;
			background-color: red;
			border-top-right-radius: 20rpx;
			border-bottom-left-radius: 20rpx;
		}
		
	}

</style>
